<div class="da-list-wrap">
  <div class="da-content-banner">
    <d-breadcrumb>
      <d-breadcrumb-item><a routerLink="/">{{ 'product.breadcrumb.home' | translate }}</a></d-breadcrumb-item>
      <d-breadcrumb-item><a routerLink="/pages/product/productJobPink">{{ 'product.breadcrumb.productJob' | translate
          }}</a></d-breadcrumb-item>
      <d-breadcrumb-item>生产退料单-维护</d-breadcrumb-item>
    </d-breadcrumb>
  </div>
  <div class="da-content-wrapper">
    <div class="da-form-container ">
      <div class="card">
        <div class="card-title">
          <p class="form-title">生产退料单-维护</p>
        </div>
        <form dForm ngForm [layout]="layoutDirection" [labelSize]="'sm'" [labelAlign]="'end'" (dSubmit)="submit()">
          <div class="form-body">
            <div class="grid mt-3">
              <div class="u-1-2 ">
                <d-form-item>
                  <d-form-label>
                    <span class="label"><span class="Required">*</span>退料单号</span>
                  </d-form-label>
                  <d-form-control>
                    <input dTextInput class="form-input-box" name="退料单号"
                      [(ngModel)]="CreateJobOrderReturn.jobOrderReturnNum" disabled="true">
                  </d-form-control>
                </d-form-item>
              </div>
              <div class="u-1-2">
                <d-form-item>
                  <d-form-label>
                    <span class="label"><span class="Required">*</span>创建人</span>
                  </d-form-label>
                  <d-form-control>
                    <input dTextInput class="form-input-box" name="创建人" placeholder="请选择人员"
                      [(ngModel)]="CreateJobOrderReturn.creatorName" disabled>
                  </d-form-control>
                </d-form-item>
              </div>
              <div class="u-1-2">
                <d-form-item>
                  <d-form-label>
                    <span class="label"><span class="Required">*</span>发料方式</span>
                  </d-form-label>
                  <d-form-control>
                    <d-button (btnClick)="issuances()"><span>批量发料</span></d-button>
                    <d-button style="margin-left: 8px;" (btnClick)="selectPart()"><span>单独发料</span></d-button>
                  </d-form-control>
                </d-form-item>
              </div>
            </div>
            <div>
              <h4>退料汇总表</h4>
            </div>
            <div class="table">
              <d-data-table [dataSource]="this.CreateJobOrderReturn.jobOrderReturnDetails" [lazy]="true"
                [scrollable]="true" [fixHeader]="true" [tableOverflowType]="'auto'" [scrollable]="true"
                [resizeable]="true" [tableWidthConfig]="tableWidthConfig">
                <thead dTableHead>
                  <tr dTableRow>
                    <th dHeadCell>
                      <span>操作</span>
                    </th>
                    <th dHeadCell *ngFor="let colOption of dataTableOptions.columns" [title]="colOption.header">
                      {{colOption.header}}</th>
                  </tr>
                </thead>
                <tbody dTableBody>
                  <ng-template let-rowItem="rowItem" let-rowIndex="rowIndex">
                    <tr dTableRow>
                      <td dTableCell>
                        <a class="devui-link-danger me-2" (click)="delete(rowIndex)">删除</a>
                        <a class="devui-link" (click)="apart(rowIndex)">拆分</a>
                      </td>
                      <td dTableCell><span  dTooltip [content]="rowItem?.jobNum">{{rowItem.jobNum}}</span></td>
                      <td dTableCell><span  dTooltip [content]="rowItem?.processName">{{rowItem.processName}}</span></td>
                      <td dTableCell><span  dTooltip [content]="rowItem?.partName">{{rowItem.partName}}</span></td>
                      <td dTableCell><span  dTooltip [content]="rowItem?.requirementQuantity">{{rowItem.requirementQuantity}}</span></td>
                      <td dTableCell><span  dTooltip [content]="rowItem?.issueQuantity">{{rowItem.issueQuantity}}</span></td>
                      <td dTableCell>
                        <div style="display: flex; justify-content: center;">
                          <input style="width: 80%;" type="number" class="devui-form-control"
                            [(ngModel)]="rowItem.returnQuantity" [ngModelOptions]="{standalone: true}"
                            [max]="rowItem.returnQuantity" [min]="1" />
                        </div>
                      </td>
                      <td dTableCell>
                        <div style="display: flex; justify-content: center;">
                          <input style="width: 80%;" class="devui-form-control" [ngModel]="rowItem.defaultWarehouseName"
                            [ngModelOptions]="{standalone: true}" readonly (click)="SelectStorehouse(rowItem)"
                            placeholder="选择仓库" />
                        </div>
                      </td>
                      <td dTableCell>
                        <div style="display: flex; justify-content: center;">
                          <input style="width: 80%;" class="devui-form-control" [ngModel]="rowItem.defaultPositionName"
                            [ngModelOptions]="{standalone: true}" (click)="selectPosition(rowItem)" readonly
                            placeholder="选择仓位" />
                        </div>
                      </td>
                      <td dTableCell>{{rowItem.stockQuantity ?? 0}}</td>
                    </tr>
                  </ng-template>
                </tbody>
              </d-data-table>
            </div>
          </div>
          <d-form-operation>
            <d-button bsStyle="primary" dFormSubmit>确定</d-button>
            <d-button class="ms-3" bsStyle="common" (btnClick)="cancle()">取消</d-button>
          </d-form-operation>
        </form>
      </div>
    </div>
  </div>
</div>
<d-toast [value]="msgs" [life]="2000" [styleClass]="'custom-class'" [style]="{ left: '50%',top:'10px' }"></d-toast>
